package com.xxl.job.executor.service.jobhandler;


import com.ruoyi.bizsys.mapper.LoanDeferredOrderMapper;
import com.ruoyi.common.utils.DateUtils;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 定时任务：每天尼日时间凌晨00:00执行定时任务，将来源是催收系统且状态为处理中的延期订单改为取消；
 * 催收系统发起的延期订单只在当天有效；
 *
 * @author ruoyi
 */
@Slf4j
@Component
public class CollectionWalletDefferJob {

    @Autowired
    LoanDeferredOrderMapper loanDeferredOrderMapper;

    /**
     * CollectionWalletBuyDefer
     */
    @XxlJob("collectionWalletDefferJobHandler")
    public void execute() {
        XxlJobHelper.log("催收钱包延期订单任务 Start >>>>>>>>>>");
        loanDeferredOrderMapper.LoanDeferredOrderFaild(DateFormatUtils.format(new Date(), DateUtils.YYYY_MM_DD + " 00:00"));
        XxlJobHelper.log("催收钱包延期订单任务 End >>>>>>>>>>");
    }
}